# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        黄周云  
# Name:         hmwk01
# Description:  创建三个类：Person，Teacher和Student，这三个类中，Person是Teacher和Student的父类
# Author:       ASUS
# Date:         2019/3/13
#-------------------------------------------------------------------------------


class Person:
    def setxinxi(self,name,age,sex):
        "设置姓名、年龄和性别"
        self.name = name
        self.age = age
        self.sex = sex

    def getxinxi(self):
        "获得姓名、年龄和性别"
        return "name = {} age = {} sex = {}".format(self.name,self.age,self.sex)

    def greet(self):
        "自我介绍"
        return "大家好，我叫{},今年{}岁".format(self.name,self.age)


class Teacher(Person):
    def setdata(self,school,course,salary):
        "设置老师所在学校、教授的科目和工资"
        self.school = school
        self.course = course
        self.salary = salary

    def getdata(self):
        "获取老师所在学校、教授科目和工资"
        return "school = {} course = {} salary = {}".format(self.school,self.course,self.salary)

    def greet(self):
        "自我介绍"
        return "大家好，我是一名{}老师".format(self.course)


class Student(Person):
    def setdata1(self,school,major,grade):
        "设置学生的姓名，专业和年级"
        self.school = school
        self.major = major
        self.grade = grade

    def getdata1(self):
        "获取学生的学校，专业和年级"
        return  "school = {} major = {} grade = {}".format(self.school,self.major,self.grade)

    def greet(self):
        "自我介绍"
        return "大家好，我是一名{}专业的学生"


if __name__ == '__main__':
    teacher = Teacher()
    teacher.setxinxi("张三",39,"男")
    teacher.setdata("湖南工业大学","高数",5000)
    print(teacher.getxinxi(),teacher.getdata())
    print(teacher.greet())
    student = Student()
    student.setxinxi("黄周云",21,"女")
    student.setdata1("湖南工业大学","信管","大三")
    print("name = {} school = {}".format(student.name,student.school))








